package com.gongfutrip.trans.client.common;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class Message implements Serializable {

    private static final long serialVersionUID = 6455564874104179712L;
    private Map<String, String> properties;
    private byte[] body;
    private String addr;// 地址
    private int requestCode;

    public Message(int requestCode) {
        this.requestCode = requestCode;

    }

    public Message(int requestCode, String addr, byte[] body) {
        this.requestCode = requestCode;
        this.addr = addr;
        this.body = body;
    }

    public int getRequestCode() {
        return requestCode;
    }

    public void setRequestCode(int requestCode) {
        this.requestCode = requestCode;
    }

    public Map<String, String> getProperties() {
        return properties;
    }

    public void setProperties(Map<String, String> properties) {
        this.properties = properties;
    }

    public void putProperty(final String name, final String value) {
        if (null == this.properties) {
            this.properties = new HashMap<>();
        }

        this.properties.put(name, value);
    }

    public String getProperty(final String name) {
        if (null == this.properties) {
            this.properties = new HashMap<>();
        }

        return this.properties.get(name);
    }

    public byte[] getBody() {
        return body;
    }

    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    public void setBody(byte[] body) {
        this.body = body;
    }
}
